{% extends 'common/basic_layout.html' %}

{% block content %}
    <div class="col-sm-12">
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h5>执行记录</h5>
                <a class=" pull-right" href="javascript:history.go(-1)">返回</a>
            </div>

            <div class="ibox-content timeline">
                {% for o in result_list %}
                    <div class="timeline-item">
                        <div class="row">
                            <div class="col-xs-4 date">
                                <i class="fa fa-briefcase"></i> {{ o.create_time }}
                                <br>
                                <small class="text-navy">{{ o.human_time }}</small>
                            </div>
                            <div class="col-xs-7 content no-top-border">
                                <p>作业名称: {{ o.result_hist.0.job }}</p>
                                <p>目标主机: {{ o.result_hist.0.host }}</p>
                                <a href="javascript:void(0)" onclick="showHistory('{{ o.id }}')">详细信息</a>
                                <div id="{{ o.id }}" style="display: none">
                                    {% for v in o.result_hist %}

                                        <p>
                                            作业命令: {{ v.job_cmd|replace_to_br }}
                                        </p>
                                        <p>
                                            作业信息: {{ v.deploy_message|replace_to_br }}
                                        </p>
                                        <p>执行时长: {{ v.duration }}毫秒</p>
                                        <p>其他信息: {{ v.stderr|replace_to_br }}</p>
                                        <p>提示信息: {{ v.comment|replace_to_br }}</p>
                                        <p>
                                            执行情况:
                                            {% if v.is_success %}执行成功
                                            {% else %}执行失败
                                            {% endif %}
                                        </p>
                                        <hr/>
                                    {% endfor %}
                                </div>
                            </div>

                        </div>
                    </div>
                {% endfor %}
            </div>
            <div class="hr-line-dashed"></div>
            {% include 'common/pagination.html' %}
        </div>
    </div>
    <script>
        function showHistory(id) {
            $('#' + id).toggle()
        }
    </script>
{% endblock %}